<?php SQLFile::start() ?>

SELECT *
FROM
( exam_session RIGHT JOIN exam USING( exam_id ) )
WHERE org_id = :org_id
AND (user_id = :user_id OR user_id IS NULL)
ORDER BY exam_id ASC


<?php return SQLFile::end();
